package com.ws.universal.tools.network;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.model.Response;

import java.util.Map;

/**
 * @author:ws
 * @date: 2021/8/9 18:31
 * @desc 使用示例
 */
public class okHttpModelExample {

    //添加 header
    public HttpHeaders getHttpHeaders() {
        HttpHeaders headers = new HttpHeaders();
        headers.put("Accept-Language", "zh-CN,zh;q=0.8");
        headers.put("User-Agent", "okhttp/MyTools");
        headers.put("token", "07ee3d1b73aa5395bd455788f6a17204");
        return headers;
    }


    public void get(String url, Map<String, String> map, final int ids, final NetWorkListener listener) {
        OkGo.<String>get(url).params(map).headers(getHttpHeaders()).execute(new StringCallback() {
            @Override
            public void onSuccess(Response<String> response) {


            }

            @Override
            public void onError(Response<String> response) {

            }
        });

    }


    public void post(String url, Map<String, String> map, final int ids, final NetWorkListener listener) {


    }

}
